<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <body>

        <ui:composition template="./resources/template/template.xhtml">

            <ui:define name="title">
                Manage Dashboards
            </ui:define>

            <ui:define name="content">
                <h:form >
                    <p:panel >
                        <f:facet name="header" >
                            <p:outputLabel value="Manage Dashboards" ></p:outputLabel>
                            <p:commandButton ajax="false" value="Back" action="#{webUserController.backToViewUsers()}" >
                            </p:commandButton>
                        </f:facet>

                        <h:panelGrid columns="2" >
                            <p:outputLabel value="Name" ></p:outputLabel>
                            <p:outputLabel value="#{webUserController.current.webUserPerson.name}" ></p:outputLabel>

                            <p:outputLabel value="Dashboard" ></p:outputLabel>
                            <p:selectOneMenu value="#{webUserController.dashboard}" >
                                <f:selectItem itemLabel="Select" ></f:selectItem>
                                <f:selectItems value="#{enumController.dashboardTypes}" ></f:selectItems>
                            </p:selectOneMenu>

                            <p:commandButton ajax="false" action="#{webUserController.addWebUserDashboard()}" value="Add" >
                            </p:commandButton>


                        </h:panelGrid>

                        <p:dataTable value="#{webUserController.webUserDashboards}" var="d">
                            <p:column >
                                <p:outputLabel value="#{d.dashboard}" ></p:outputLabel>

                            </p:column>
                            <p:column>
                                <p:commandButton ajax="false" action="#{webUserController.removeWebUserDashboard()}" value="Remove" >
                                    <f:setPropertyActionListener value="#{d}" target="#{webUserController.webUserDashboard}" ></f:setPropertyActionListener>
                                </p:commandButton>
                            </p:column>

                        </p:dataTable>



                    </p:panel>

                </h:form>
            </ui:define>



        </ui:composition>

    </body>
</html>
